home *** CD-ROM | disk | FTP | other *** search
Gui4CLI script | 1999-11-23 | 2.6 KB | 86 lines |
- G4C
-
- ; MULTISELECT LISTVIEWS
-
- ; This is an example of multiselect listviews.
- ; Here again we have to give a file name which the listview will
- ; display.
-
- ; We'll display the "guis:docs/printme" file in one and nothing in
- ; the other. The button transfers the selected lines
-
-
- WINBIG 112 91 371 290 ListViews2.gc
- WinType 11110001
- resinfo 14 640 512
- BOX 0 0 371 290 out button
-
-
- xOnLoad
- GuiOpen ListViews2.gc
-
- xOnClose
- GuiQuit ListViews2.gc
-
-
- ; ----------------------------------------------------------
- ; The 2 listviews
- ; ----------------------------------------------------------
-
-
- ; Note that a multiselect lv will "happen" whenever the user double
- ; clicks on an item. Here, we'll not do anything when the user
- ; double clicks.. (that's why the lv's don't have any commands attached)
-
- ; ---- The Top listview
-
- XLISTVIEW 3 3 364 142 "" Top.lv "guis:docs/printme" 10 MULTI
- gadid 1
- ; we'll give this one a monospace font..
- gadfont #mono 8 000
-
-
- ; ---- The bottom listview (no file)
-
- XLISTVIEW 4 168 362 118 "" Bottom.lv "" 10 MULTI
- GadID 2
-
-
- ; ----------------------------------------------------------
- ; A button to transfer selected items
- ; ----------------------------------------------------------
-
- ; to do this we have to use the lvmulti command to see which of the
- ; lines in the Top listview have been selected. We use the internal
- ; variables to get our results - yes.. go read all about them..
-
-
- XBUTTON 3 146 323 21 "Copy Selected items to Bottom Listview -->>"
- lvuse listviews2.gc 1 ; use the Top listview
- lvmulti first ; get the first selected record
- while $$lv.line > '' ; while there *are* selected items
- dummy = $$lv.rec ; store the selected line into a variable
- lvuse listviews2.gc 2 ; use the other (Bottom) listview
- lvadd $dummy ; append the line to it
- lvuse listviews2.gc 1 ; use the Top listview again
- lvmulti off ; unselect the line we just transfered
- lvmulti next ; get the next selected line
- endwhile ; .. until there are no more - i.e., until
- ; the $$lv.line internal variable = ''
-
- ; Note that in Gui4Cli 0 is a valid number.
- ; The top line of a listview is the 0th line.
- ; This may seem confusing in the begining but there is a weird kind of
- ; sense in it, so bear with me..
-
- ; When the Current Line is the top line, then $$lv.line = 0
-
- ; When Gui4Cli runs out of selected lines, the current line will
- ; be set to nothing (i.e. $$lv.line = '') and that's how we know that
- ; we're finished.
-
- ; That's why we use the - while $$lv.line > '' - comparison above
-
-
-
-